<template>
    <div id="ChartUsers" ref="chartDom">123</div>
</template>

<script setup>
import { onMounted, ref, watch } from 'vue';
const chartDom = ref(0)



let option

onMounted(() => {

    $api.getActiveUsers().then((res) => {
        option = {
            textStyle: {
                fontFamily: 'Dosis'
            },
            title: {
                text: "Users"
            },
            xAxis: {
                type: 'category',
                data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
            },
            yAxis: {
                type: 'value'
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '1%',
                containLabel: true
            },
            legend: {
                top: '0',
                data: ['new', 'active']
            },
            tooltip: {
                trigger: 'axis',
            },
            series: [
                {
                    name: "new",
                    data: res.new,
                    type: 'bar'
                },
                {
                    name: "active",
                    data: res.active,
                    type: 'bar'
                }
            ]
        }
        const CHART = $echarts.init(chartDom.value)
        CHART.setOption(option)
    })
})
</script>

<style lang='less' >
#ChartUsers {
    height: 100%;
}
</style>
